package com.youlu.campus.service.ca;

import com.youlu.campus.entity.CaInfo;
import com.youlu.campus.entity.ShippingBatch;
import com.youlu.campus.entity.UserCaInfo;
import com.youlu.campus.entity.UserCaInfoComment;
import com.youlu.campus.entity.VO.req.CaInfoQueryVO;
import com.youlu.campus.entity.VO.req.CopyCaInfoReq;
import com.youlu.campus.entity.VO.req.CreateCaOrderTagVO;
import com.youlu.campus.entity.VO.req.UserCaInfoQueryVO;
import com.youlu.campus.entity.enums.TaskBizType;
import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface CaInfoService {

    Page<CaInfo> list(CaInfoQueryVO req);

    CaInfo findOne(String id);

    boolean create(CaInfo req);

    boolean update(CaInfo req);

    boolean delete(String tanentId, String id);


    Page<UserCaInfo> list(UserCaInfoQueryVO req);

    UserCaInfo getUserCaInfo(String tenantId, String id);

    /**
     * 添加订单标签
     *
     * @param req
     * @return
     */
    List<String> createTags(CreateCaOrderTagVO req);

    /**
     * 创建备注
     *
     * @param req
     * @return
     */
    boolean createComment(UserCaInfoComment req);

    /**
     * 获取订单备注
     *
     * @param req
     * @return
     */
    List<UserCaInfoComment> getComments(UserCaInfoComment req);

    /**
     * 发货
     *
     * @param req
     * @return
     */
    boolean shipping(UserCaInfo req);

    /**
     * 退款预操作操作
     */
    boolean preRefund(UserCaInfo req);

    /**
     * 退款审核
     */
    boolean doRefund(UserCaInfo req);

    /**
     * 订单导出
     *
     * @param req
     * @param response
     * @return
     */
    boolean export(UserCaInfoQueryVO req, HttpServletResponse response);

    /**
     * 创建发货批次
     *
     * @param req
     * @return
     */
    boolean createShippingBatch(ShippingBatch req);

    /**
     * 修改发货批次
     *
     * @param req
     * @return
     */
    boolean updateShippingBatch(ShippingBatch req);

    /**
     * 删除发货批次
     *
     * @param tenantId
     * @param id
     * @return
     */
    boolean deleteShippingBatch(String tenantId, String id);

    /**
     * 导入活动明细
     *
     * @param file
     * @param tenantId
     * @return
     */
    HashMap<String, Object> importShippingBatchDetail(MultipartFile file, String batchId, String tenantId);

    /**
     * 导入证书
     *
     * @param inputStream
     * @param fileName
     * @param caGroupId
     * @return
     */
    Map<String, Object> caImport(byte[] inputStream, String fileName, String caGroupId);


    Page<CaInfo> listByGroupId(CaInfoQueryVO req);


    CaInfo findCaInfoById(String id);

    List<CaInfo> findByMaterialConfigId(String activityId, String materialConfigId);


    List<CaInfo> findByMaterialConfigId(String activityId, List<String> materialConfigIds);


    List<CaInfo> find(String activityId, String level);

    /**
     * 证书序列复制
     *
     * @param copyCaInfoReq
     */
    void copyCaInfo(CopyCaInfoReq copyCaInfoReq);

    List<CaInfo> findByActivityId(String activityId);

    List<CaInfo> findByParentId(String parentId);

    List<CaInfo> findWithQuery(Query q);
}
